﻿<!--#include file="../base.asp"-->
<%if IsLogin then %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>保存作业</title>
</head>

<body>
<%
dim contid,sql,rs,rsadd
contid=request.QueryString("contid")
if request.Form("content")<>"" then
sql="select * from workpost where workID="&contid&" and userNum='"&request.Cookies("username")&"' and [delete]=0"
set rs=GetRecordset(sql,0)

if rs.eof or rs.bof then
sql="select * from workpost"
set rsadd=GetRecordset(sql,1)
rsadd.addnew
rsadd("content")=request.Form("content")
rsadd("wpDate")=now()
rsadd("userNum")=request.Cookies("username")
rsadd("workID")=contid
rsadd.update
showMsg "添加成功！",3,""
response.write("<script langusge='javascript'>window.location='comm/list_submitwork.aspx';</script>")
rsadd.close
set rsadd=nothing
CLoseDataBase
else
if isnull(rs("commContent")) and isnull(rs("commJudge")) then
'修改无类别信息
sql="select * from workpost where workID="&contid&" and userNum='"&request.Cookies("username")&"' and [delete]=0"
set rsadd=GetRecordset(sql,1)
if not rsadd.eof and not rsadd.bof then
rsadd("content")=request.Form("content")
rsadd("wpDate")=now()
rsadd("userNum")=request.Cookies("username")
rsadd("workID")=contid
rsadd.update
showMsg "修改成功！",3,""
response.write("<script langusge='javascript'>window.location='comm/list_submitwork.aspx';</script>")
rsadd.close
set rsadd=nothing
CLoseDataBase
else showMsg "警告：非法操作！",3,""
end if
else showMsg "作业已评价，不能再提交",3,""
response.write("<script langusge='javascript'>window.location='comm/list_submitwork.aspx';</script>")
end if
end if

else 
    showMsg "内容不能为空！<br />点击<a href='javascript:history.back()'>这里</a>返回",4,"" 
end if
%>
</body>
</html>
<%end if %>